﻿namespace Sidvall.FileSystemManager.Net.Services.V1
{
    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling")]
    public sealed partial class RenameConfig : global::Sidvall.Data.ServiceDataRowBase, global::Sidvall.FileSystemManager.Data.IRenameConfig
    {
        #region Public Members

        #region CaseSensitive

        private bool _CaseSensitive;
        partial void OnBeforeCaseSensitivePropertyChanged(Sidvall.Business.PropertyChangeEventData<bool> eventData);
        partial void OnAfterCaseSensitivePropertyChanged();
        public bool CaseSensitive
        { 
            get
            {
                return _CaseSensitive;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _CaseSensitive = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<bool> eventData = new Sidvall.Business.PropertyChangeEventData<bool>(value, _CaseSensitive);
                    OnBeforeCaseSensitivePropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("CaseSensitive", eventData.Value, true, true);
                        OnAfterCaseSensitivePropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region FolderPath

        private string _FolderPath;
        partial void OnBeforeFolderPathPropertyChanged(Sidvall.Business.PropertyChangeEventData<string> eventData);
        partial void OnAfterFolderPathPropertyChanged();
        public string FolderPath
        { 
            get
            {
                return _FolderPath;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _FolderPath = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<string> eventData = new Sidvall.Business.PropertyChangeEventData<string>(value, _FolderPath);
                    OnBeforeFolderPathPropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("FolderPath", eventData.Value, true, true);
                        OnAfterFolderPathPropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region NewName1

        private string _NewName1;
        partial void OnBeforeNewName1PropertyChanged(Sidvall.Business.PropertyChangeEventData<string> eventData);
        partial void OnAfterNewName1PropertyChanged();
        public string NewName1
        { 
            get
            {
                return _NewName1;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _NewName1 = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<string> eventData = new Sidvall.Business.PropertyChangeEventData<string>(value, _NewName1);
                    OnBeforeNewName1PropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("NewName1", eventData.Value, true, true);
                        OnAfterNewName1PropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region NewName2

        private string _NewName2;
        partial void OnBeforeNewName2PropertyChanged(Sidvall.Business.PropertyChangeEventData<string> eventData);
        partial void OnAfterNewName2PropertyChanged();
        public string NewName2
        { 
            get
            {
                return _NewName2;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _NewName2 = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<string> eventData = new Sidvall.Business.PropertyChangeEventData<string>(value, _NewName2);
                    OnBeforeNewName2PropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("NewName2", eventData.Value, true, true);
                        OnAfterNewName2PropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region NewName3

        private string _NewName3;
        partial void OnBeforeNewName3PropertyChanged(Sidvall.Business.PropertyChangeEventData<string> eventData);
        partial void OnAfterNewName3PropertyChanged();
        public string NewName3
        { 
            get
            {
                return _NewName3;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _NewName3 = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<string> eventData = new Sidvall.Business.PropertyChangeEventData<string>(value, _NewName3);
                    OnBeforeNewName3PropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("NewName3", eventData.Value, true, true);
                        OnAfterNewName3PropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region OldName1

        private string _OldName1;
        partial void OnBeforeOldName1PropertyChanged(Sidvall.Business.PropertyChangeEventData<string> eventData);
        partial void OnAfterOldName1PropertyChanged();
        public string OldName1
        { 
            get
            {
                return _OldName1;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _OldName1 = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<string> eventData = new Sidvall.Business.PropertyChangeEventData<string>(value, _OldName1);
                    OnBeforeOldName1PropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("OldName1", eventData.Value, true, true);
                        OnAfterOldName1PropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region OldName2

        private string _OldName2;
        partial void OnBeforeOldName2PropertyChanged(Sidvall.Business.PropertyChangeEventData<string> eventData);
        partial void OnAfterOldName2PropertyChanged();
        public string OldName2
        { 
            get
            {
                return _OldName2;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _OldName2 = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<string> eventData = new Sidvall.Business.PropertyChangeEventData<string>(value, _OldName2);
                    OnBeforeOldName2PropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("OldName2", eventData.Value, true, true);
                        OnAfterOldName2PropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region OldName3

        private string _OldName3;
        partial void OnBeforeOldName3PropertyChanged(Sidvall.Business.PropertyChangeEventData<string> eventData);
        partial void OnAfterOldName3PropertyChanged();
        public string OldName3
        { 
            get
            {
                return _OldName3;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _OldName3 = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<string> eventData = new Sidvall.Business.PropertyChangeEventData<string>(value, _OldName3);
                    OnBeforeOldName3PropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("OldName3", eventData.Value, true, true);
                        OnAfterOldName3PropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region RecursiveFolders

        private bool _RecursiveFolders;
        partial void OnBeforeRecursiveFoldersPropertyChanged(Sidvall.Business.PropertyChangeEventData<bool> eventData);
        partial void OnAfterRecursiveFoldersPropertyChanged();
        public bool RecursiveFolders
        { 
            get
            {
                return _RecursiveFolders;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _RecursiveFolders = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<bool> eventData = new Sidvall.Business.PropertyChangeEventData<bool>(value, _RecursiveFolders);
                    OnBeforeRecursiveFoldersPropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("RecursiveFolders", eventData.Value, true, true);
                        OnAfterRecursiveFoldersPropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region RenameConfigId

        private System.Nullable<int> _RenameConfigId;
        partial void OnBeforeRenameConfigIdPropertyChanged(Sidvall.Business.PropertyChangeEventData<System.Nullable<int>> eventData);
        partial void OnAfterRenameConfigIdPropertyChanged();
        public System.Nullable<int> RenameConfigId
        { 
            get
            {
                return _RenameConfigId;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _RenameConfigId = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<System.Nullable<int>> eventData = new Sidvall.Business.PropertyChangeEventData<System.Nullable<int>>(value, _RenameConfigId);
                    OnBeforeRenameConfigIdPropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("RenameConfigId", eventData.Value, true, true);
                        OnAfterRenameConfigIdPropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region RenameFiles

        private bool _RenameFiles;
        partial void OnBeforeRenameFilesPropertyChanged(Sidvall.Business.PropertyChangeEventData<bool> eventData);
        partial void OnAfterRenameFilesPropertyChanged();
        public bool RenameFiles
        { 
            get
            {
                return _RenameFiles;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _RenameFiles = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<bool> eventData = new Sidvall.Business.PropertyChangeEventData<bool>(value, _RenameFiles);
                    OnBeforeRenameFilesPropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("RenameFiles", eventData.Value, true, true);
                        OnAfterRenameFilesPropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region RenameFolders

        private bool _RenameFolders;
        partial void OnBeforeRenameFoldersPropertyChanged(Sidvall.Business.PropertyChangeEventData<bool> eventData);
        partial void OnAfterRenameFoldersPropertyChanged();
        public bool RenameFolders
        { 
            get
            {
                return _RenameFolders;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _RenameFolders = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<bool> eventData = new Sidvall.Business.PropertyChangeEventData<bool>(value, _RenameFolders);
                    OnBeforeRenameFoldersPropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("RenameFolders", eventData.Value, true, true);
                        OnAfterRenameFoldersPropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region SearchPatterns

        private string _SearchPatterns;
        partial void OnBeforeSearchPatternsPropertyChanged(Sidvall.Business.PropertyChangeEventData<string> eventData);
        partial void OnAfterSearchPatternsPropertyChanged();
        public string SearchPatterns
        { 
            get
            {
                return _SearchPatterns;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _SearchPatterns = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<string> eventData = new Sidvall.Business.PropertyChangeEventData<string>(value, _SearchPatterns);
                    OnBeforeSearchPatternsPropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("SearchPatterns", eventData.Value, true, true);
                        OnAfterSearchPatternsPropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region UpdateFileContents

        private bool _UpdateFileContents;
        partial void OnBeforeUpdateFileContentsPropertyChanged(Sidvall.Business.PropertyChangeEventData<bool> eventData);
        partial void OnAfterUpdateFileContentsPropertyChanged();
        public bool UpdateFileContents
        { 
            get
            {
                return _UpdateFileContents;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _UpdateFileContents = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<bool> eventData = new Sidvall.Business.PropertyChangeEventData<bool>(value, _UpdateFileContents);
                    OnBeforeUpdateFileContentsPropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("UpdateFileContents", eventData.Value, true, true);
                        OnAfterUpdateFileContentsPropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region DataRowContextStorageKey

        protected override string DataRowContextStorageKey
        {
            get
            {
                return global::Sidvall.FileSystemManager.SystemContext.Current.EntityFacade.RenameConfigManager.GetKey(this);
            }
        }

        #endregion
        #region DataRowStateIsDirty

        protected override bool DataRowStateIsDirty
        {
            get
            {
                return global::Sidvall.FileSystemManager.SystemContext.Current.EntityFacade.RenameConfigManager.DataRowStateIsDirty(this);
            }
        }

        #endregion
        #region LoadInstanceField

        public void LoadInstanceField(string fieldName, object value, bool cascade, bool updateState)
        {
            global::Sidvall.FileSystemManager.SystemContext.Current.EntityFacade.RenameConfigManager.LoadInstanceField(this, fieldName, value, cascade, false, updateState);
        }

        #endregion
        #region Copy

        public RenameConfig Copy()
        {
            return global::Sidvall.FileSystemManager.SystemContext.Current.EntityFacade.RenameConfigManager.Copy(this);
        }
        public RenameConfig Copy(Sidvall.Data.CopySettings settings)
        {
            return global::Sidvall.FileSystemManager.SystemContext.Current.EntityFacade.RenameConfigManager.Copy(this, settings);
        }

        #endregion
        #region Import

        public void Import(global::Sidvall.FileSystemManager.Data.IRenameConfig item)
        {
            global::Sidvall.FileSystemManager.SystemContext.Current.EntityFacade.RenameConfigManager.Import(this, item);
        }
        public void Import(global::Sidvall.FileSystemManager.Data.IRenameConfig item, Sidvall.Data.CopySettings settings)
        {
            global::Sidvall.FileSystemManager.SystemContext.Current.EntityFacade.RenameConfigManager.Import(this, item, settings);
        }

        #endregion
        #region ValidateAsync

        public async System.Threading.Tasks.Task<Sidvall.Data.BusinessRuleCollection> ValidateAsync()
        {
            return await global::Sidvall.FileSystemManager.SystemContext.Current.EntityFacade.RenameConfigManager.ValidateAsync(this).ConfigureAwait(false);
        }
        public async System.Threading.Tasks.Task<Sidvall.Data.BusinessRuleCollection> ValidateAsync(Sidvall.Data.ValidationSettings settings)
        {
            return await global::Sidvall.FileSystemManager.SystemContext.Current.EntityFacade.RenameConfigManager.ValidateAsync(this, settings).ConfigureAwait(false);
        }

        #endregion
        #region Initialize

        public void Initialize()
        {
            global::Sidvall.FileSystemManager.SystemContext.Current.EntityFacade.RenameConfigManager.Initialize(this);
        }
        public void Initialize(Sidvall.Data.InitializeSettings settings)
        {
            global::Sidvall.FileSystemManager.SystemContext.Current.EntityFacade.RenameConfigManager.Initialize(this, settings);
        }

        #endregion

        #region IRenameConfig Members

        bool global::Sidvall.FileSystemManager.Data.IRenameConfig.CaseSensitive
        {
            get
            {
                return this._CaseSensitive;
            }
            set
            {
                this._CaseSensitive = value;
            }
        }
        string global::Sidvall.FileSystemManager.Data.IRenameConfig.FolderPath
        {
            get
            {
                return this._FolderPath;
            }
            set
            {
                this._FolderPath = value;
            }
        }
        string global::Sidvall.FileSystemManager.Data.IRenameConfig.NewName1
        {
            get
            {
                return this._NewName1;
            }
            set
            {
                this._NewName1 = value;
            }
        }
        string global::Sidvall.FileSystemManager.Data.IRenameConfig.NewName2
        {
            get
            {
                return this._NewName2;
            }
            set
            {
                this._NewName2 = value;
            }
        }
        string global::Sidvall.FileSystemManager.Data.IRenameConfig.NewName3
        {
            get
            {
                return this._NewName3;
            }
            set
            {
                this._NewName3 = value;
            }
        }
        string global::Sidvall.FileSystemManager.Data.IRenameConfig.OldName1
        {
            get
            {
                return this._OldName1;
            }
            set
            {
                this._OldName1 = value;
            }
        }
        string global::Sidvall.FileSystemManager.Data.IRenameConfig.OldName2
        {
            get
            {
                return this._OldName2;
            }
            set
            {
                this._OldName2 = value;
            }
        }
        string global::Sidvall.FileSystemManager.Data.IRenameConfig.OldName3
        {
            get
            {
                return this._OldName3;
            }
            set
            {
                this._OldName3 = value;
            }
        }
        bool global::Sidvall.FileSystemManager.Data.IRenameConfig.RecursiveFolders
        {
            get
            {
                return this._RecursiveFolders;
            }
            set
            {
                this._RecursiveFolders = value;
            }
        }
        System.Nullable<int> global::Sidvall.FileSystemManager.Data.IRenameConfig.RenameConfigId
        {
            get
            {
                return this._RenameConfigId;
            }
            set
            {
                this._RenameConfigId = value;
            }
        }
        bool global::Sidvall.FileSystemManager.Data.IRenameConfig.RenameFiles
        {
            get
            {
                return this._RenameFiles;
            }
            set
            {
                this._RenameFiles = value;
            }
        }
        bool global::Sidvall.FileSystemManager.Data.IRenameConfig.RenameFolders
        {
            get
            {
                return this._RenameFolders;
            }
            set
            {
                this._RenameFolders = value;
            }
        }
        string global::Sidvall.FileSystemManager.Data.IRenameConfig.SearchPatterns
        {
            get
            {
                return this._SearchPatterns;
            }
            set
            {
                this._SearchPatterns = value;
            }
        }
        bool global::Sidvall.FileSystemManager.Data.IRenameConfig.UpdateFileContents
        {
            get
            {
                return this._UpdateFileContents;
            }
            set
            {
                this._UpdateFileContents = value;
            }
        }

        #endregion

        #endregion
        #region Constructors

        public RenameConfig()
        {
        }
        public RenameConfig(bool initializeDefaultValues)
            : this(initializeDefaultValues, null, Sidvall.Business.BusinessEvents.None)
        {
        }
        public RenameConfig(bool initializeDefaultValues, Sidvall.Data.DataRowState? dataRowState, Sidvall.Business.BusinessEvents enabledBusinessEvents)
            : base(dataRowState, enabledBusinessEvents)
        {
            if (initializeDefaultValues)
                global::Sidvall.FileSystemManager.SystemContext.Current.EntityFacade.RenameConfigManager.Initialize(this);
        }

        #endregion
    }
}